﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Daily.aspx.cs" Inherits="Credit_Teacher_DailyManage_Daily" %>

<%@ Register Src="../../../Custom/SchoolGrade.ascx" TagName="SchoolGrade" TagPrefix="uc2" %>

<%@ Register Src="../../../Custom/SchoolYear.ascx" TagName="SchoolYear" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Common/css/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Common/js/jquery.js"></script>
    <script type="text/javascript" src="../../Common/js/common.js"></script>
    <script type="text/javascript" src="../../../Common/js/TableForExport.js"></script>
    <style type="text/css">
        a:hover{text-decoration:underline;}
    </style>
    
    <script type="text/javascript">
        var pageType = 0;
        function detailView(type)
        {
            var liList = parent.leftFrame.document.getElementById("detailLi");
        }
        
        function getExcel()
        {
            var cells = GetTableInfo(document.getElementById("<%=tbResult.ClientID %>"));
            if(cells!=null)
            {
//document.getElementById("lblTitle").innerText,
                PageMethods.GetExcel(cells,function(result){
                document.getElementById('downloadf').src = "";
                document.getElementById('downloadf').src = "../../../PostFileBytes.aspx";
                },function(err){alert(err._message);alert(err._message);});
            }
            
        }
        function OnView()
        {
            parent.frames["mainFrame"].location.href="../Reprots/CauseTermEval.aspx";
        }
        
        function Select()
        {
            var selMonth = document.getElementById('selMonth');
            var month = selMonth.options[selMonth.selectedIndex].value;
            
            document.getElementById('txtYear').value = GetCurrentYear;
            document.getElementById('txtTerm').value = GetCurrentTerm;
            document.getElementById('txtMonth').value = month;
            document.getElementById('txtGrade').value =  GetCurrentGrade; 
            document.getElementById('txtMonthDate').value = selMonth.options[selMonth.selectedIndex].innerText;
         
            document.getElementById('btnQuery').click();
        }
    </script>
    
</head>
<body SCROLL="no" id="bodyest" style="height: 90%; padding-top: 5px; padding-left: 5px; overflow-y: none; overflow-x: none;" >
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        </asp:ScriptManager>
        <div id="divMain" class="mainWarp" style="width: 100%; height: 99%;">
            <div class="pageBody" style="width: 100%; height: 99%; margin: 0px 0px 0px 0px;">
                
                <div style="margin:0 0; padding:8px 0px 0px 0px;">
                <table border="0">
                    <tr>
                        <td style=" padding-left:10px;" class="FixedRowCol">
                            <uc1:SchoolYear ID="SchoolYear1" runat="server" />
                            
                            
                            </td>
                        <td style=" padding-left:10px;" class="FixedRowCol">
                            <uc2:SchoolGrade ID="SchoolGrade1" runat="server" /> 
                            </td>
                        <td style=" padding-left:10px;" class="FixedRowCol">
                        <td>  <select id="selMonth" >
                            </select> </td>
                       
                     <%--   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                           
                            </ContentTemplate>
                            <Triggers>
                               
                            </Triggers>
                        </asp:UpdatePanel>--%>
                        </td>
                        <td  style="margin:0 0; padding:0px 5px 0px 0px;" class="FixedRowCol">
                            <input class="commonBut" onclick="Select();" value="查询" type="button" />
                           
                        </td>
                        <td style=" padding-left:10px;" class="FixedRowCol">
                            <input id="Button2" type="button" class="commonBut" value="导出Excel" onclick="getExcel()" />
                        </td>
                    </tr>
                    
                </table>
                </div>
                
                <div style="overflow-y:auto;overflow-x:none;height:98%;">
                <div id="divTable" style="width:600px;  height:300px; margin:left; overflow: auto;position: relative;">
                <asp:UpdatePanel ID="upResult" runat="server">
                    <ContentTemplate>
                        <div style="padding-left:5px;display:none;"><h3><asp:Label ID="lblTitle" runat="server" /></h3></div>
                        <asp:Table ID="tbResult" runat="server" Style="margin-left: 5px;">
                        </asp:Table>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnQuery" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                </div></div>
                
                <div style="display:none;">
                    <asp:TextBox ID='txtYear' runat="server" />
                    <asp:TextBox ID='txtTerm' runat="server" />
                    <asp:TextBox ID='txtGrade' runat="server" />
                    <asp:TextBox ID='txtMonth' runat="server" />
                    <asp:TextBox ID='txtMonthDate' runat="server">  </asp:TextBox>
                    <asp:Button class="commonBut" ID="btnQuery" runat="server" Text="查询" OnClick="btnQuery_Click" />
                </div>
            </div>
        </div>
    </form>
    <div id="upInputPop" class="layoutWarp" style="display: none">
        <iframe src="" name="downloadf" id="downloadf" style="height: 80%;width: 95%;overflow-y:auto;overflow-x:none;" frameborder="0"   ></iframe>
    </div>
</body>
<script language="javascript">
    SetChange(SelYearChange);
    pageType = <%=GetPageType %>;   
    if (pageType == 0)
    {// 当前学期
        document.getElementById('startYear').style.display = 'none';
    }
    else
    {// 历史学期
        document.getElementById('startYear').style.display = 'block';
    }
    
    function resizeTable(){
        var h=0;
        var w=0;
        if(document.body.scrollHeight>document.getElementById("bodyest").clientHeight)
        {
            h = document.getElementById("bodyest").clientHeight;
        }
        else
        {
            h = document.body.scrollHeight;
        }
        if(document.body.scrollWidth>document.getElementById("bodyest").clientWidth)
        {
            w = document.getElementById("bodyest").clientWidth+20;
        }
        else
        {
            w = document.body.scrollWidth-30;
        }
        
        if(h>0 && w>0)
        {
            document.getElementById("divTable").style.height=h+"px";
            document.getElementById("divTable").style.width=w+"px";
        }
    }
    resizeTable();
    
    
    function InitMonth()
    {
        document.getElementById('txtYear').value = GetCurrentYear;
        document.getElementById('txtTerm').value = GetCurrentTerm;
        
        PageMethods.YearChanged(GetCurrentYear,GetCurrentTerm,pageType,function(succ){
            if(succ != null)
            {
                var selMonth = document.getElementById('selMonth');
                selMonth.innerHTML = "";
                for(var i=0; i < succ.length;i++)
                {
                    var oOption = document.createElement("OPTION");
                
                    oOption.text=succ[i][0];
                    oOption.value=succ[i][1];
                    selMonth.add(oOption);  
                }  
                Select();
            } 
        },
        function(err){
        }
        );
    }
    InitMonth();
   
    function SelYearChange()
    {   
        document.getElementById('txtYear').value = GetCurrentYear;
        document.getElementById('txtTerm').value = GetCurrentTerm;
        
        PageMethods.YearChanged(GetCurrentYear,GetCurrentTerm,pageType,function(succ){
            if(succ != null)
            {
                var selMonth = document.getElementById('selMonth');
                selMonth.innerHTML = "";
                for(var i=0; i < succ.length;i++)
                {
                    var oOption = document.createElement("OPTION");
                
                    oOption.text=succ[i][0];
                    oOption.value=succ[i][1];
                    selMonth.add(oOption);  
                }  
                
            } 
        },
        function(err){
        }
        );
    }
    
  
</script>

</html>
